﻿@using Sniper.Mapping.SysUserToken
@model IEnumerable<SysUserTokenMapping>
@{
    ViewBag.Title = "登陆用户Token";
}
<div class="breadcrumbs" id="breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="ace-icon fa fa-home home-icon"></i>
            <a href="@Url.RouteUrl("homeIndex")">首页</a>
        </li>
        <li class="active">@ViewBag.Title</li>
    </ul>
</div>
<div class="page-content">
    <h1>@ViewBag.Title</h1>
    <hr />
    @if (Model != null)
    {
        <div class="row">
            <div class="col-sm-12">
                <table id="user_datatable" class="table table-striped table-bordered table-hover dataTable no-footer">
                    <thead>
                        <tr>
                            <th width="300px">ID</th>
                            <th width="150px">过期时间</th>
                            <th width="110px">账号</th>
                            <th width="100px">姓名</th>
                            <th width="150px">最后登陆时间</th>
                            <th width="100px">登陆IP</th>
                            <th width="150px">活动时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>@item.Id</td>
                                <td>@item.ExpireTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                                <td>@item.SysUser.Account</td>
                                <td>@item.SysUser.Name</td>
                                <td>@(item.SysUser.LastLoginTime?.ToString("yyyy-MM-dd HH:mm:ss"))</td>
                                <td>@item.SysUser.LastIpAddress</td>
                                <td>@(item.SysUser.LastActivityTime?.ToString("yyyy-MM-dd HH:mm:ss"))</td>
                                <td>
                                    @if (item.SysUserId != WorkContext.CurrentUser.Id)
                                    {
                                        @PermissionRouteLinkIcon(" 强制退出", "userTokenLogOut", new RouteValueDictionary(new { id = item.Id }), new { @class = "btn btn-xs btn-default btnOut" }, new { @class = "fa fa-power-off " })
                                    }
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
            <script>
                $(function () {
                    $('.btnOut').click(function (e) {
                        e.preventDefault();
                        var url = $(this).attr('href');
                        $.modal.confirm('您确定要退出此用户的登陆？', function () {
                            $.get(url, function (data) {
                                $.modal.alert(data);
                            });
                        });
                    });
                });
            </script>
    }
</div>















